<?php

namespace Core;

class Config extends \Core\Urclass {

    protected $config = array();
    protected $loadedConfigs = array();

    public function __construct() {
        parent::__construct(__CLASS__);
    }

    public function loadConfig($file, $config = null) {

        $config = (!is_null($config)) ? $config : $file;

        if(!in_array($file . '/' . $config, $this->loadedConfigs)) {

            require('config/' . $file . '.php');

            $this->config[$config] = $$config;
        }
    }

    public function getConfig($config) {
        return $this->config[$config];
    }

    public function getConfigElement($config, $element) {
        return $this->config[$config][$element];
    }
}